package com.zjmzxfzhl.modules.app.service.impl;

import com.zjmzxfzhl.modules.app.entity.AppTerm;
import com.zjmzxfzhl.modules.app.form.AppLogVo;
import com.zjmzxfzhl.modules.app.form.AppTermVo;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zjmzxfzhl.common.core.base.BaseServiceImpl;
import com.zjmzxfzhl.modules.app.entity.AppLog;
import com.zjmzxfzhl.modules.app.mapper.AppLogMapper;
import com.zjmzxfzhl.modules.app.service.AppLogService;

import java.util.List;

/**
 * Service
 * 
 * @author 张森荣
 */
@Service
public class AppLogServiceImpl extends BaseServiceImpl<AppLogMapper, AppLog>
        implements AppLogService {
    @Override
    public IPage<AppLogVo> list(IPage<AppLogVo> page, AppLogVo appLogVo) {
        return page.setRecords(baseMapper.list(page, appLogVo));
    }

    @Override
    public List<AppLogVo> getList(IPage<AppLogVo> page, AppLogVo appLogVo) {
        return baseMapper.list(page, appLogVo);
    }

    /**
     * 添加操作记录
     *
     * @param content
     * @param type
     * @param typeId
     * @return
     */
    public boolean addLog(String content,String type,String typeId){
        //添加任务操作记录
        AppLog appLog = new AppLog();
        appLog.setContent(content);
        appLog.setLogType(type);
        appLog.setLogTypeId(typeId);
        return this.save(appLog);
    }

    /**
     * 监听添加操作记录
     *
     * @param content
     * @param type
     * @param typeId
     * @param userId
     * @return
     */
    public boolean addListenerLog(String content,String type,String typeId,String userId){
        //添加任务操作记录
        AppLog appLog = new AppLog();
        appLog.setContent(content);
        appLog.setLogType(type);
        appLog.setLogTypeId(typeId);
        appLog.setCreateBy(userId);
        return this.save(appLog);
    }
}
